<template>
  <div class="title" :style="{ color: textColor }">
    <slot />
    <div class="extra">
      <slot v-if="showExtra" name="extra">
        <img :src="icon" alt="icon" @click="$emit('click', $event)" />
      </slot>
    </div>
  </div>
</template>

<script>
import icon from './assets/nor_bt_morepop.png';
import { includes } from 'lodash-es';
export default {
  name: 'info-title',
  emits: ['click'],
  props: {
    textColor: { type: String, default: '#6ccfc7' },
    icon: { type: [String, Boolean], default: icon },
  },
  computed: {
    showExtra() {
      return (this.icon && this.$attrs.onMore) || this.$slots.extra;
    },
  },
};
</script>

<style scoped lang="less">
.title {
  font-size: 16px;
  font-weight: bold;
  color: #6ccfc7;
  &:before {
    color: #6ccfc7;
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.2em;
    margin-top: -0.2em;
    margin-right: 9px;
    background: currentColor;
    border-radius: 2px;
    vertical-align: middle;
  }
  .extra {
    margin-left: 10px;
    display: inline-block;
    cursor: pointer;
  }
}
</style>
